package icu.lookyousmileface.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * @author starrysky
 * @title: SyncService
 * @projectName springboot-sync_task
 * @description: service
 * @date 2021/2/1101:08
 */
@Service
public class SyncService {
//    告诉sprig这是一个异步任务，但是需要开启@EnableAsync注解
    @Async
    public void hello(){
        try {
            TimeUnit.SECONDS.sleep(3);
        }catch (InterruptedException e){
            e.printStackTrace();
        }
        System.out.println("数据正在处理中。。。。。");
    }
}
